<template>
    <div>

    </div>
</template>

<script lang="ts">
import { defineComponent, reactive, Ref, ref } from 'vue'
interface ArrayType {
    name: string,
    age: number
}
interface ObjType extends ArrayType {    //ObjType继承了ArrayType接口内的检测
    // name: string,
    // age: number
}

export default defineComponent({
    setup() {
                                  //Array<ArrayType>或ArrayType[]
        const state = reactive<{ arr: ArrayType[], obj: ObjType }>({
            arr: [{ name: "Tom", age: 18 }],
            obj: { name: "Jerry", age: 8 }
        })
        //ref的另一种类型检测方法
        const str: Ref<string> = ref("superman")
        return {}
    }
})
</script>

<style scoped></style>